package Demo1;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-06-02
 * Time: 16:25
 */
public class Test {
    public static void main(String[] args) {
        Login login = new Login();
        login.setName("abc");
        login.setPassword("123456");

        while(true){
            try{
                System.out.println("请输入用户名");
                Scanner scanner = new Scanner(System.in);
                String name = scanner.nextLine();
                System.out.println("请输入密码");
                String password = scanner.nextLine();
                login.loginInfo(name,password);
                break;
            }catch(UserPassword e){
                System.out.println("密码错误，请重新输入");
            }catch(Username e){
                System.out.println("用户名错误，请重新输入");
            }
        }
        System.out.println("输入正确...");
    }
}
